/*
 * @Author: jares
 * @Date: 2024-02-29 14:30:44
 * @LastEditors: jares
 * @LastEditTime: 2025-06-03 17:00:38
 * @Description:
 * X轴name相关配置
 * Copyright (c) 2024 by jares, All Rights Reserved.
 */
class XAxisName {
	constructor(options = {}) {
		this.options = options

	}
	init() {
		const {
			type = 'category',
			name = 'X',
			nameLocation = 'end',
			nameGap = 0,
			nameTextStyle = {},
			axisLabel = {},
			axisTick = {},
			data = [],
			...extra
		} = this.options
		return  {
			type,
			name,
			nameLocation,
			nameGap,
			nameTextStyle: {
				fontFamily: nameTextStyle.fontFamily || 'PingFang-Medium',
				fontSize: nameTextStyle.fontSize || 14,
				color: nameTextStyle.color || '#666',
				padding: nameTextStyle.padding || [10, 0, 0, 0],
				align: nameTextStyle.align || 'right',
				verticalAlign: nameTextStyle.verticalAlign || 'top',
				...nameTextStyle
			},
			axisTick: {
				show: axisTick.show ?? false
			},
			axisLabel:{
				fontSize: nameTextStyle.fontSize || 14,
				...axisLabel,
			},
			data,
			...extra,
		}
	}
}
const xAxisName = (obj) => {
	return new XAxisName(obj).init()
}
export default xAxisName
